
$.ajaxSetup({
    headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
});
function  changetab(e) {
    $(e).siblings().removeAttr('class');//去除同级元素的class
    $(e).attr('class','active');
    var findtype = $(e).attr('value');
    $.ajax({
        type: 'get',
        url: '/xrtab',
        data: {typeid: findtype,servertype: 2},
        success: function (res) {
            if (res)
            {
                $(".change_tab").html(res)
            }
        }
    });
}

/**
 * 首页查询所有寻人消息
 * @param e
 */
function allfind(e) {
    $(e).siblings().removeAttr('class');//去除同级元素的class
    $(e).attr('class','active');
    $.ajax({
        type: 'get',
        url: '/xrtab',
        data: {typeid: 'all'},
        success: function (res) {
            if (res)
            {
                $(".change_tab").html(res)
            }
        }
    });
}
/**
 * 切换城市
 * @param a
 */
function changecity(a)
{
    //获取当前城市编号
    var city_code = $(a).attr("value");
    //种下cookie
    $.cookie('citycode', city_code);
    window.location.reload()

}
function suggest_news(e)
{
	$(e).siblings().removeAttr('class');//去除同级元素的class
    $(e).attr('class','active');
    var newstype = $(e).attr('value');
	$(".replace_box").attr('style','display:block');
    $.ajax({
        type: 'get',
        url: '/indexnews',
        data: {newstype: newstype,server_type: 2},
        success: function (res) {
            if (res)
            {
                $(".replace_box").html(res)
            }
        }
    });
}